﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DietNum_rcjk.aspx.cs" Inherits="Catering.DisplayBoards.DietNum_rcjk" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Src="../UCPanle/UCSearchToolRCJK.ascx" TagName="UCDDLToolWithDate"
    TagPrefix="uc1" %>
<%@ Register Src="../UCPanle/UCSearchToolForRCJK.ascx" TagName="UCSearchToolForRCJK"
    TagPrefix="uc3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../Style/center.css" />
    <link rel="stylesheet" type="text/css" href="../Style/zhezhao.css" />
    <link type="text/css" rel="stylesheet" href="../Catering_Page/Tool_Reporter/css/highslide.css" />
    <script src="../Style/zhezhao.js" type="text/javascript"></script>
    <script src="../scripts/js_ajax.js" type="text/javascript"></script>
    <script src="../Style/xxk.js" type="text/javascript"></script>
    <script type="text/javascript" src="../Catering_Page/Tool_Reporter/js/jquery.min.js"></script>
    <script type="text/javascript">
        function GetData(year, month, title, data) {
            WaitState('container', 1);
            var divnum = 0;
            var chart;
            var options = {
                chart: { renderTo: 'container' }, //容器ID
                title: { text: title + '人均日常监控（单位：g）' }, //报表大标题
                //subtitle: { text: '报表小标题' }, //报表小标题
                xAxis: {//x轴
                    type: 'sdf',
                    categories: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16',
                        '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'],
                    gridLineWidth: 0,
                    labels: { align: 'left', x: -6, y: 16 }
                },
                yAxis: [{ // left y axis
                    title: {
                        text: null
                    },
                    labels: {
                        align: 'left',
                        x: 3,
                        y: 16,
                        formatter: function () {
                            return Highcharts.numberFormat(this.value, 0);
                        }
                    },
                    showFirstLabel: false
                },
                { // right y axis
                    linkedTo: 0,
                    gridLineWidth: 1,
                    opposite: true,
                    title: { text: null },
                    labels: {
                        align: 'right',
                        x: -3,
                        y: 16,
                        formatter: function () {
                            return Highcharts.numberFormat(this.value, 0);
                        }
                    },
                    showFirstLabel: true
                }],
                //                legend: {//图例样式
                //                    align: 'center',
                //                    verticalAlign: 'bottom',
                //                    y:-20,
                //                    floating: true,
                //                    borderWidth: 0
                //                },
                tooltip: {
                    formatter: function () {
                        return '<b>' + this.x + '日：</b><br/>' +
                        this.series.name + ': ' + this.y;
                    }
                },
                plotOptions: {
                    series: {
                        cursor: 'pointer',
                        point: {
                            events: {
                                click: function () {
                                    if (this.series.name.indexOf("就餐人数") <= 0) {
                                        hs.htmlExpand(null, {
                                            pageOrigin: {
                                                x: this.pageX,
                                                y: this.pageY
                                            },
                                            headingText: title.replace("标准消耗", "").replace("实际消耗", "") + "消耗总量监控（单位：kg）", //弹窗标题
                                            maincontentText: "<div style='width:100%; height:300px;' id='maincontent" + divnum + "'></div>", //弹窗内容
                                            width: 500
                                        });
                                        var objname = this.series.name;
                                        objname = objname.replace("标准消耗", "");
                                        objname = objname.replace("实际消耗", "");
                                        GetMainContentValue(year, month, this.x + 1, objname, "maincontent" + divnum);
                                        divnum++;
                                    }
                                }
                            }
                        },
                        marker: {
                            lineWidth: 1
                        }
                    }
                },
                //Highcharts弹窗内容
                series: []
            };
            for (var i = 3; i < arguments.length; i++) {
                options.series[i - 3] = arguments[i];
            }
            chart = new Highcharts.Chart(options);
        }
        var dn;
        var x_title = new Array();
        function GetMainContentValue(year, month, day, classname, divname) {
            var areaid = document.getElementById("UCDDLToolWithDate1_ddl_Area").value;
            var DTime = year + "-" + month + "-" + day;
            var rawid = GetCheckBoxValue("UCSearchToolForRCJK1_CheckBoxList1_", 6);
            dn = divname;
            //设置x轴标题
            var x_data = rawid.split(",");
            for (var j = 0; j < x_data.length; j++) {
                if (x_data[j] == 3) {
                    x_title[j] = "肉类";
                }
                else if (x_data[j] == 4) {
                    x_title[j] = "鱼虾类";
                }
                else if (x_data[j] == 6) {
                    x_title[j] = "蔬菜类";
                }
                else if (x_data[j] == 7) {
                    x_title[j] = "水果类";
                }
                else if (x_data[j] == 8) {
                    x_title[j] = "谷类薯类及杂豆";
                }
            }
            Catering.Catering_Page.AjaxHandler.WebServiceRcjk.GetFactXiaoHao(areaid, classname, DTime, rawid, addHighcharts);
        }
        function GetCheckBoxValue(id, num) {
            var result = "";
            for (var i = 0; i < num; i++) {
                var a = document.getElementById(id + i);
                if (a && a.type == "checkbox" && a.checked && a.value != -1) {
                    result += a.value + ",";
                }
            }
            if (result.length > 0) result = result.substring(0, result.length - 1);

            return result;
        }
        function addHighcharts(objdata) {
            if (dn != null) {
                var charta;
                var optionsa = {
                    chart: { renderTo: dn, type: 'column' },
                    title: { text: '  ' }, //报表大标题
                    xAxis: {//x轴肉类：3、鱼虾类：4、蔬菜类：6、水果类：7、谷类薯类及杂豆：8
                        type: 'sdff',
                        categories: [],
                        gridLineWidth: 0
                    },
                    yAxis: [{ // left y axis
                        title: {
                            text: null
                        },
                        labels: {
                            formatter: function () {
                                return Highcharts.numberFormat(this.value, 0);
                            }
                        }
                    },
                { // right y axis
                    linkedTo: 0,
                    gridLineWidth: 1,
                    opposite: true,
                    title: { text: null },
                    labels: {
                        formatter: function () {
                            return Highcharts.numberFormat(this.value, 0);
                        }
                    },
                    showFirstLabel: true
                }],
                    tooltip: {
                        shared: true
                    },
                    //Highcharts弹窗内容
                    series: []
                };
                optionsa.xAxis.categories = x_title;
                optionsa.series = objdata.Rcjks;
                charta = new Highcharts.Chart(optionsa);
            }
        }

        function GetDataGroupByBanZu(year, month, day, title, banzu, data) {
            WaitState('container', 1);
            var tiptitle = "";
            var divnum = 0;
            var chart;
            var banzuptions = {
                chart: { renderTo: 'container' }, //容器ID
                title: { text: title + '人均日常监控（单位：g）' }, //报表大标题
                //subtitle: { text: '报表小标题' }, //报表小标题
                xAxis: {//x轴
                    type: 'sdf',
                    categories: banzu,
                    gridLineWidth: 0,
                    labels: { align: 'left', x: -6, y: 16 }
                },
                yAxis: [{ // left y axis
                    title: {
                        text: null
                    },
                    labels: {
                        align: 'left',
                        x: 3,
                        y: 16,
                        formatter: function () {
                            return Highcharts.numberFormat(this.value, 0);
                        }
                    },
                    showFirstLabel: false
                },
                { // right y axis
                    linkedTo: 0,
                    gridLineWidth: 1,
                    opposite: true,
                    title: { text: null },
                    labels: {
                        align: 'right',
                        x: -3,
                        y: 16,
                        formatter: function () {
                            return Highcharts.numberFormat(this.value, 0);
                        }
                    },
                    showFirstLabel: true
                }],
                tooltip: {
                    formatter: function () {
                        tiptitle = this.x;
                        return '<b>' + this.x + '：</b><br/>' +
                        this.series.name + '：' + this.y;
                    }
                },
                plotOptions: {
                    series: {
                        cursor: 'pointer',
                        point: {
                            events: {
                                click: function () {
                                    if (this.series.name.indexOf("就餐人数") <= 0) {
                                        hs.htmlExpand(null, {
                                            pageOrigin: {
                                                x: this.pageX,
                                                y: this.pageY
                                            },
                                            headingText: title + tiptitle + "班组" + "消耗总量监控", //弹窗标题
                                            maincontentText: "<div style='width:100%; height:300px;' id='maincontent" + divnum + "'></div>", //弹窗内容
                                            width: 500
                                        });
                                        tiptitle = tiptitle.replace("标准消耗", "");
                                        tiptitle = tiptitle.replace("实际消耗", "");
                                        GetMainContentValueByBanzu(year, month, day, tiptitle, "maincontent" + divnum);
                                        divnum++;
                                    }
                                }
                            }
                        },
                        marker: {
                            lineWidth: 1
                        }
                    }
                },
                series: []
            };
            for (var i = 5; i < arguments.length; i++) {
                banzuptions.series[i - 5] = arguments[i];
            }
            chart = new Highcharts.Chart(banzuptions);
        }

        function GetMainContentValueByBanzu(year, month, day, classname, divname) {
            var areaid = document.getElementById("UCDDLToolWithDate1_ddl_Area").value;
            var DTime = year + "-" + month + "-" + day;
            var rawid = GetCheckBoxValue("UCSearchToolForRCJK1_CheckBoxList1_", 6);
            dn = divname;
            //设置x轴标题
            var x_data = rawid.split(",");
            for (var j = 0; j < x_data.length; j++) {
                if (x_data[j] == 3) {
                    x_title[j] = "肉类";
                }
                else if (x_data[j] == 4) {
                    x_title[j] = "鱼虾类";
                }
                else if (x_data[j] == 6) {
                    x_title[j] = "蔬菜类";
                }
                else if (x_data[j] == 7) {
                    x_title[j] = "水果类";
                }
                else if (x_data[j] == 8) {
                    x_title[j] = "谷类薯类及杂豆";
                }
            }
            Catering.Catering_Page.AjaxHandler.WebServiceRcjk.GetFactXiaoHaoByBanZu(areaid, classname, DTime, rawid, addHighcharts);
        }

        function WaitState(id, flag) {
            var rongqi = document.getElementById(id);
            if (rongqi && flag == 0) {
                rongqi.innerHTML = "<div style='width:100%; height:40px; line-height:40px; text-align:center; font-size:13px; color:#ff0000; font-weight:bold; margin-top:20px;'>正在读取数据，请稍后！</div>";
            }
            else if (flag == 1) {
                rongqi.innerHTML = "";
            }
        }
    </script>
</head>
<body>
    <form id="Form1" runat="server">
    <script type="text/javascript" src="../Catering_Page/Tool_Reporter/js/highcharts.js"></script>
    <script type="text/javascript" src="../Catering_Page/Tool_Reporter/js/modules/exporting.js"></script>
    <script type="text/javascript" src="../Catering_Page/Tool_Reporter/js/highslide-full.min.js"></script>
    <script type="text/javascript" src="../Catering_Page/Tool_Reporter/js/highslide.config.js" charset="utf-8"></script>
    <asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" runat="server">
    <Services>
    <asp:ServiceReference Path="~/Catering_Page/AjaxHandler/WebServiceRcjk.asmx" />
    </Services>
    </asp:ScriptManager>
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="Center_Content" id="div2_1" style="display:none">
                <div class="div_0207 left_width500" style="height: 34px; width: 998px;">
                    <table align="left" width="100%" border="0" cellspacing="0" cellpadding="0" class="ckgl_table"
                        style="height: 34px">
                        <thead>
                            <tr>
                                <td width="10">
                                </td>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="Center_Content" id="div1" style="display:none">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>
                            <uc3:UCSearchToolForRCJK ID="UCSearchToolForRCJK1" runat="server"/>
                        </td>
                    </tr>
                </table>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div id="container" style="width: 1000px; height: 400px; margin: 0 auto">
    </div>    
        <div class="clear_div">
    </div>
    </form>
</body>
</html>